package com.chf.springboot_test.Controller;

import com.chf.springboot_test.beans.Student;
import com.chf.springboot_test.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/test")
//@Profile("dev")
public class MyController {

    @Autowired
    private IUserInfoService userInfoService;

    @RequestMapping("/login")
    public String Login(){
        return "page/main";
    }

    @ResponseBody
    @RequestMapping("/addInfo")
    public String AddUserInfo(Student student){
        System.out.println("添加用户：======"+student);
        int i = userInfoService.AddUserInfo(student);
        if (i>0){
             return "添加成功";
        }else {
            return "添加失败";
        }
    }
}
